#!/bin/sh

set -x

# nginx: secrets; one-nginx
# udev rules
# sysctl scripts

case "$1" in
	'')
		timestamp=$(date '+%Y-%m-%dT%H:%M')
		tar caf "/var/lib/backup/infra_$timestamp.tgz" /var/lib/syncthing/GPS/ /etc/nginx/ /usr/share/secrets/secrets.tar.age /home/git/git-shell-commands/ /home/git/me/ /home/git/pass.git/ /home/git/.ssh/ /home/git/.gitconfig config/ /var/lib/jellyfin/data/ /var/lib/jellyfin/plugins/ /var/lib/jellyfin/root/
		chgrp backup "/var/lib/backup/infra_$timestamp.tgz"
		chmod g+r "/var/lib/backup/infra_$timestamp.tgz"
		;;
	'clean')
		rm /var/lib/backup/infra_*.tgz
		;;
esac
